package com.wyc.serviceDriverUser.service.impl;

import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.wyc.internalCommon.result.ApiResult;
import com.wyc.serviceDriverUser.dto.DriverUserWorkStatus;
import com.wyc.serviceDriverUser.mapper.DriverUserWorkStatusMapper;
import com.wyc.serviceDriverUser.service.DriverUserWorkStatusService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 司机出车状态 服务实现类
 * </p>
 *
 * @author li
 * @since 2023-03-26
 */
@Service
public class DriverUserWorkStatusServiceImpl extends ServiceImpl<DriverUserWorkStatusMapper, DriverUserWorkStatus> implements DriverUserWorkStatusService {

    @Autowired
    private DriverUserWorkStatusMapper workStatusMapper;

    /**
     * 根据driverId修改司机工作状态
     * @param workStatus
     * @return
     */
    @Override
    public ApiResult updateWorkStatus(DriverUserWorkStatus workStatus) {
        UpdateWrapper<DriverUserWorkStatus> updateWrapper = new UpdateWrapper<>();
        updateWrapper.eq("driver_id",workStatus.getDriverId());
        int update = workStatusMapper.update(workStatus, updateWrapper);
        return ApiResult.success(update);
    }
}
